public class Offer56I {
    public int singleNumber(int[] nums) {
        int[] count = new int[32];
        for (int num : nums) {
            for (int i = 0; i < count.length; i++) {
                count[i]+=num&1;
                num>>>=1;
            }
        }
        int res = 0;
        for (int i = 0; i <count.length ; i++) {
            res<<=1;
            res|=count[31-i]%3;
        }
        return res;
    }
}
